package test1;

public class StartGame {
    public static void main(String[] args) {
        //设定角色信息
        Role r1=new Role("小明",100,"男");
        Role r2=new Role("小红",100,"女");
        r1.setDescription(r1.getGender());
        r2.setDescription(r2.getGender());

        //展示角色信息
        System.out.println("以下是所设定的角色");
        System.out.println();
        //展示r1信息
        System.out.println(r1.getName());
        System.out.println("性别: "+r1.getGender());
        System.out.println("血量: "+r1.getBlood());
        System.out.println("特征: "+r1.getDescription());
        System.out.println();
        //展示r2信息
        System.out.println(r2.getName());
        System.out.println("性别: "+r2.getGender());
        System.out.println("血量: "+r2.getBlood());
        System.out.println("特征: "+r2.getDescription());
        System.out.println();

        //开始进行攻击
        //提示游戏开始
        System.out.println("游戏开始！");
        System.out.println();
        //进行攻击
        while (true) {
            //r1攻击r2
            r1.attack(r2);
            //判断r2血量情况
            if (r2.getBlood() == 0) {
                //输出结束信息
                System.out.println(r2.getName() + "被" + r1.getName() + "打败了！");
                System.out.println("游戏结束！");
                break;
            }

            //r2攻击r1
            r2.attack(r1);
            //判断r1血量情况
            if (r1.getBlood() == 0) {
                //输出结束信息
                System.out.println(r1.getName() + "被" + r2.getName() + "打败了！");
                System.out.println("游戏结束！");
                break;
            }
        }
    }
}
